
export function useServerSelect(Api) {
  let timeout
  let currentValue

  function fetch(value) {
    if (timeout) {
      clearTimeout(timeout)
      timeout = null
    }
    currentValue = value
    function _Api() {
      if (currentValue === value) {
        Api()
      }
    }
    timeout = setTimeout(_Api, 400, currentValue)
  }

  return {
    fetch,
  }
}
